cmake_minimum_required(VERSION 3.0.2)
project(can_ros1_driver)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  tf
  std_msgs
  nav_msgs
  # mw_lidar
  sensor_msgs
  geometry_msgs
  # ultralytics_ros
  message_generation
  radar_perception_msgs
)

add_message_files(
  FILES
  CarState.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

# catkin_package( CATKIN_DEPENDS roscpp tf std_msgs mw_lidar nav_msgs sensor_msgs geometry_msgs ultralytics_ros)
catkin_package( CATKIN_DEPENDS roscpp tf std_msgs nav_msgs sensor_msgs geometry_msgs message_runtime radar_perception_msgs) 

include_directories(
  include
  ${catkin_INCLUDE_DIRS})

add_executable(can_receive_node src/can_receive.cpp src/can_receive_node.cpp)
# add_dependencies(can_receive_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(can_receive_node can_ros1_driver_generate_messages_cpp) # ${${PROJECT_NAME}_EXPORTED_TARGETS} you zheyixiang
target_link_libraries(can_receive_node ${catkin_LIBRARIES})

add_executable(can_send_node src/can_send.cpp src/can_send_node.cpp)
add_dependencies(can_send_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
# add_dependencies(can_send_node can_ros1_driver_generate_messages_cpp)
target_link_libraries(can_send_node ${catkin_LIBRARIES})

add_executable(Car_data_saver_node src/Car_data_saver.cpp)
target_link_libraries(Car_data_saver_node
  ${catkin_LIBRARIES}
  # -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lzstd -lssl -lcrypto -lresolv -lm
  -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lssl -lcrypto -lresolv -lm
)
